Download the executable from the official site and place it in the
/usr/local/bin/
.sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Grant the execution permission.
sudo chmod +x /usr/local/bin/docker-compose
Prepare dockerfile for test. e.g. pytest.Dockerfile
- Add
wait-for-it.sh
if the service is not ready immediately. - Reference: Control startup and shutdown order in Compose
- Add
Example docker compose config yaml (TODO)
Build the related image first.
docker-compose build
- Run the testing service.
docker-compose run
- Remember to shut down all the services once finished.
docker-compose down
- To check if there is any service from docker compose
docker-compose ps